using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using MobileClient.UIProcessService;

namespace MobileClient
{
	/// <summary>
	/// Summary description for ctlYesNoEntry.
	/// </summary>
	public class ctlYesNoEntry : Control
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.RadioButton rbNo;
		private System.Windows.Forms.RadioButton rbYes;

		private YesNoEntry m_objEntry;

		public ctlYesNoEntry()
		{
			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();

			m_objEntry = null;
		}

		public YesNoEntry Entry
		{
			get { return m_objEntry; }
			set { m_objEntry = value; }
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if( components != null )
					components.Dispose();
			}
			base.Dispose( disposing );
		}

		#region Component Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify 
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.rbNo = new System.Windows.Forms.RadioButton();
			this.rbYes = new System.Windows.Forms.RadioButton();
			// 
			// rbNo
			// 
			this.rbNo.Location = new System.Drawing.Point(96, 86);
			this.rbNo.Size = new System.Drawing.Size(44, 20);
			this.rbNo.Text = "No";
			// 
			// rbYes
			// 
			this.rbYes.Location = new System.Drawing.Point(96, 46);
			this.rbYes.Size = new System.Drawing.Size(44, 20);
			this.rbYes.Text = "Yes";
			// 
			// ctlYesNoEntry
			// 
			this.Controls.Add(this.rbNo);
			this.Controls.Add(this.rbYes);
			this.Size = new System.Drawing.Size(236, 152);

		}
		#endregion

		public void LoadSettings()
		{
			if(m_objEntry != null)
			{
				if(m_objEntry.Response == "Yes")
				{
					rbYes.Checked = true;
				}
				else
				{
					rbNo.Checked = true;
				}
			}
		}

		public void SaveSettings()
		{
			if(m_objEntry != null)
			{
				if(rbYes.Checked)
				{
					m_objEntry.Response = "Yes";
				}
				else
				{
					m_objEntry.Response = "No";
				}
			}
		}
	}
}
